3.1.55 \(\int \frac {\cot ^4(c+d x)}{a+i a \tan (c+d x)} \, dx\) [55]

Optimal. Leaf size=108 \[ \frac {5 x}{2 a}+\frac {5 \cot (c+d x)}{2 a d}+\frac {i \cot ^2(c+d x)}{a d}-\frac {5 \cot ^3(c+d x)}{6 a d}+\frac {2 i \log (\sin (c+d x))}{a d}+\frac {\cot ^3(c+d x)}{2 d (a+i a \tan (c+d x))} \]

[Out]

5/2*x/a+5/2*cot(d*x+c)/a/d+I*cot(d*x+c)^2/a/d-5/6*cot(d*x+c)^3/a/d+2*I*ln(sin(d*x+c))/a/d+1/2*cot(d*x+c)^3/d/(
a+I*a*tan(d*x+c))

________________________________________________________________________________________

Rubi [A]
time = 0.10, antiderivative size = 108, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3633, 3610, 3612, 3556} \begin {gather*} -\frac {5 \cot ^3(c+d x)}{6 a d}+\frac {i \cot ^2(c+d x)}{a d}+\frac {5 \cot (c+d x)}{2 a d}+\frac {2 i \log (\sin (c+d x))}{a d}+\frac {\cot ^3(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {5 x}{2 a} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]^4/(a + I*a*Tan[c + d*x]),x]

[Out]

(5*x)/(2*a) + (5*Cot[c + d*x])/(2*a*d) + (I*Cot[c + d*x]^2)/(a*d) - (5*Cot[c + d*x]^3)/(6*a*d) + ((2*I)*Log[Si
n[c + d*x]])/(a*d) + Cot[c + d*x]^3/(2*d*(a + I*a*Tan[c + d*x]))

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3610

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b
*c - a*d)*((a + b*Tan[e + f*x])^(m + 1)/(f*(m + 1)*(a^2 + b^2))), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3633

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-a
)*((c + d*Tan[e + f*x])^(n + 1)/(2*f*(b*c - a*d)*(a + b*Tan[e + f*x]))), x] + Dist[1/(2*a*(b*c - a*d)), Int[(c
 + d*Tan[e + f*x])^n*Simp[b*c + a*d*(n - 1) - b*d*n*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, n}, x
] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] &&  !GtQ[n, 0]

Rubi steps

\begin {align*} \int \frac {\cot ^4(c+d x)}{a+i a \tan (c+d x)} \, dx &=\frac {\cot ^3(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {\int \cot ^4(c+d x) (-5 a+4 i a \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {5 \cot ^3(c+d x)}{6 a d}+\frac {\cot ^3(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {\int \cot ^3(c+d x) (4 i a+5 a \tan (c+d x)) \, dx}{2 a^2}\\ &=\frac {i \cot ^2(c+d x)}{a d}-\frac {5 \cot ^3(c+d x)}{6 a d}+\frac {\cot ^3(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {\int \cot ^2(c+d x) (5 a-4 i a \tan (c+d x)) \, dx}{2 a^2}\\ &=\frac {5 \cot (c+d x)}{2 a d}+\frac {i \cot ^2(c+d x)}{a d}-\frac {5 \cot ^3(c+d x)}{6 a d}+\frac {\cot ^3(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {\int \cot (c+d x) (-4 i a-5 a \tan (c+d x)) \, dx}{2 a^2}\\ &=\frac {5 x}{2 a}+\frac {5 \cot (c+d x)}{2 a d}+\frac {i \cot ^2(c+d x)}{a d}-\frac {5 \cot ^3(c+d x)}{6 a d}+\frac {\cot ^3(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {(2 i) \int \cot (c+d x) \, dx}{a}\\ &=\frac {5 x}{2 a}+\frac {5 \cot (c+d x)}{2 a d}+\frac {i \cot ^2(c+d x)}{a d}-\frac {5 \cot ^3(c+d x)}{6 a d}+\frac {2 i \log (\sin (c+d x))}{a d}+\frac {\cot ^3(c+d x)}{2 d (a+i a \tan (c+d x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(365\) vs. \(2(108)=216\).
time = 3.40, size = 365, normalized size = 3.38 \begin {gather*} \frac {\csc (c) (\cos (d x)+i \sin (d x)) \left (14 \csc (c+d x)-28 \cos (c-d x) \csc (2 (c+d x))+14 i \sec (c+d x)-24 d x \sec (c+d x)+24 d x \cos ^2(c) \sec (c+d x)+3 \cos (c) \cos (2 d x) \sec (c+d x) \sin (c)+30 d x \sec (c+d x) \sin ^2(c)-3 i \cos (2 d x) \sec (c+d x) \sin ^2(c)+12 i \log \left (\sin ^2(c+d x)\right ) \sec (c+d x) \sin ^2(c)+24 \text {ArcTan}(\tan (d x)) \sec (c+d x) \sin (c) (-i \cos (c)+\sin (c))+2 \csc ^2(c+d x) \sec (c+d x) (\cos (c)+i \sin (c)) (i \cos (c)+2 \sin (c))-3 i d x \sec (c+d x) \sin (2 c)+6 \log \left (\sin ^2(c+d x)\right ) \sec (c+d x) \sin (2 c)-3 i \cos (c) \sec (c+d x) \sin (c) \sin (2 d x)-3 \sec (c+d x) \sin ^2(c) \sin (2 d x)-28 i \csc (2 (c+d x)) \sin (c-d x)+2 \csc ^3(c+d x) (-1+\cos (c-d x) \sec (c+d x)+i \sec (c+d x) \sin (c-d x))\right )}{12 a d (-i+\tan (c+d x))} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]^4/(a + I*a*Tan[c + d*x]),x]

[Out]

(Csc[c]*(Cos[d*x] + I*Sin[d*x])*(14*Csc[c + d*x] - 28*Cos[c - d*x]*Csc[2*(c + d*x)] + (14*I)*Sec[c + d*x] - 24
*d*x*Sec[c + d*x] + 24*d*x*Cos[c]^2*Sec[c + d*x] + 3*Cos[c]*Cos[2*d*x]*Sec[c + d*x]*Sin[c] + 30*d*x*Sec[c + d*
x]*Sin[c]^2 - (3*I)*Cos[2*d*x]*Sec[c + d*x]*Sin[c]^2 + (12*I)*Log[Sin[c + d*x]^2]*Sec[c + d*x]*Sin[c]^2 + 24*A
rcTan[Tan[d*x]]*Sec[c + d*x]*Sin[c]*((-I)*Cos[c] + Sin[c]) + 2*Csc[c + d*x]^2*Sec[c + d*x]*(Cos[c] + I*Sin[c])
*(I*Cos[c] + 2*Sin[c]) - (3*I)*d*x*Sec[c + d*x]*Sin[2*c] + 6*Log[Sin[c + d*x]^2]*Sec[c + d*x]*Sin[2*c] - (3*I)
*Cos[c]*Sec[c + d*x]*Sin[c]*Sin[2*d*x] - 3*Sec[c + d*x]*Sin[c]^2*Sin[2*d*x] - (28*I)*Csc[2*(c + d*x)]*Sin[c -
d*x] + 2*Csc[c + d*x]^3*(-1 + Cos[c - d*x]*Sec[c + d*x] + I*Sec[c + d*x]*Sin[c - d*x])))/(12*a*d*(-I + Tan[c +
 d*x]))

________________________________________________________________________________________

Maple [A]
time = 0.28, size = 89, normalized size = 0.82

method result size
derivativedivides \(\frac {-\frac {9 i \ln \left (\tan \left (d x +c \right )-i\right )}{4}+\frac {1}{2 \tan \left (d x +c \right )-2 i}-\frac {1}{3 \tan \left (d x +c \right )^{3}}+\frac {i}{2 \tan \left (d x +c \right )^{2}}+2 i \ln \left (\tan \left (d x +c \right )\right )+\frac {2}{\tan \left (d x +c \right )}+\frac {i \ln \left (\tan \left (d x +c \right )+i\right )}{4}}{d a}\) \(89\)
default \(\frac {-\frac {9 i \ln \left (\tan \left (d x +c \right )-i\right )}{4}+\frac {1}{2 \tan \left (d x +c \right )-2 i}-\frac {1}{3 \tan \left (d x +c \right )^{3}}+\frac {i}{2 \tan \left (d x +c \right )^{2}}+2 i \ln \left (\tan \left (d x +c \right )\right )+\frac {2}{\tan \left (d x +c \right )}+\frac {i \ln \left (\tan \left (d x +c \right )+i\right )}{4}}{d a}\) \(89\)
risch \(\frac {9 x}{2 a}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )}}{4 d a}+\frac {4 c}{d a}+\frac {2 i \left (6 \,{\mathrm e}^{4 i \left (d x +c \right )}-9 \,{\mathrm e}^{2 i \left (d x +c \right )}+7\right )}{3 d a \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}+\frac {2 i \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d a}\) \(102\)
norman \(\frac {\frac {i \left (\tan ^{3}\left (d x +c \right )\right )}{d a}-\frac {1}{3 d a}+\frac {5 \left (\tan ^{4}\left (d x +c \right )\right )}{2 d a}+\frac {5 x \left (\tan ^{3}\left (d x +c \right )\right )}{2 a}+\frac {5 x \left (\tan ^{5}\left (d x +c \right )\right )}{2 a}+\frac {5 \left (\tan ^{2}\left (d x +c \right )\right )}{3 d a}+\frac {i \tan \left (d x +c \right )}{2 d a}}{\tan \left (d x +c \right )^{3} \left (1+\tan ^{2}\left (d x +c \right )\right )}+\frac {2 i \ln \left (\tan \left (d x +c \right )\right )}{d a}-\frac {i \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d a}\) \(160\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^4/(a+I*a*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d/a*(-9/4*I*ln(tan(d*x+c)-I)+1/2/(tan(d*x+c)-I)-1/3/tan(d*x+c)^3+1/2*I/tan(d*x+c)^2+2*I*ln(tan(d*x+c))+2/tan
(d*x+c)+1/4*I*ln(tan(d*x+c)+I))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4/(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

Fricas [A]
time = 0.38, size = 181, normalized size = 1.68 \begin {gather*} \frac {54 \, d x e^{\left (8 i \, d x + 8 i \, c\right )} - 3 \, {\left (54 \, d x - 17 i\right )} e^{\left (6 i \, d x + 6 i \, c\right )} + 81 \, {\left (2 \, d x - i\right )} e^{\left (4 i \, d x + 4 i \, c\right )} - {\left (54 \, d x - 65 i\right )} e^{\left (2 i \, d x + 2 i \, c\right )} - 24 \, {\left (-i \, e^{\left (8 i \, d x + 8 i \, c\right )} + 3 i \, e^{\left (6 i \, d x + 6 i \, c\right )} - 3 i \, e^{\left (4 i \, d x + 4 i \, c\right )} + i \, e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) - 3 i}{12 \, {\left (a d e^{\left (8 i \, d x + 8 i \, c\right )} - 3 \, a d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, a d e^{\left (4 i \, d x + 4 i \, c\right )} - a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4/(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/12*(54*d*x*e^(8*I*d*x + 8*I*c) - 3*(54*d*x - 17*I)*e^(6*I*d*x + 6*I*c) + 81*(2*d*x - I)*e^(4*I*d*x + 4*I*c)
- (54*d*x - 65*I)*e^(2*I*d*x + 2*I*c) - 24*(-I*e^(8*I*d*x + 8*I*c) + 3*I*e^(6*I*d*x + 6*I*c) - 3*I*e^(4*I*d*x
+ 4*I*c) + I*e^(2*I*d*x + 2*I*c))*log(e^(2*I*d*x + 2*I*c) - 1) - 3*I)/(a*d*e^(8*I*d*x + 8*I*c) - 3*a*d*e^(6*I*
d*x + 6*I*c) + 3*a*d*e^(4*I*d*x + 4*I*c) - a*d*e^(2*I*d*x + 2*I*c))

________________________________________________________________________________________

Sympy [A]
time = 0.27, size = 196, normalized size = 1.81 \begin {gather*} \frac {12 i e^{4 i c} e^{4 i d x} - 18 i e^{2 i c} e^{2 i d x} + 14 i}{3 a d e^{6 i c} e^{6 i d x} - 9 a d e^{4 i c} e^{4 i d x} + 9 a d e^{2 i c} e^{2 i d x} - 3 a d} + \begin {cases} \frac {i e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: a d e^{2 i c} \neq 0 \\x \left (\frac {\left (9 e^{2 i c} + 1\right ) e^{- 2 i c}}{2 a} - \frac {9}{2 a}\right ) & \text {otherwise} \end {cases} + \frac {9 x}{2 a} + \frac {2 i \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**4/(a+I*a*tan(d*x+c)),x)

[Out]

(12*I*exp(4*I*c)*exp(4*I*d*x) - 18*I*exp(2*I*c)*exp(2*I*d*x) + 14*I)/(3*a*d*exp(6*I*c)*exp(6*I*d*x) - 9*a*d*ex
p(4*I*c)*exp(4*I*d*x) + 9*a*d*exp(2*I*c)*exp(2*I*d*x) - 3*a*d) + Piecewise((I*exp(-2*I*c)*exp(-2*I*d*x)/(4*a*d
), Ne(a*d*exp(2*I*c), 0)), (x*((9*exp(2*I*c) + 1)*exp(-2*I*c)/(2*a) - 9/(2*a)), True)) + 9*x/(2*a) + 2*I*log(e
xp(2*I*d*x) - exp(-2*I*c))/(a*d)

________________________________________________________________________________________

Giac [A]
time = 0.79, size = 116, normalized size = 1.07 \begin {gather*} -\frac {\frac {27 i \, \log \left (\tan \left (d x + c\right ) - i\right )}{a} - \frac {3 i \, \log \left (-i \, \tan \left (d x + c\right ) + 1\right )}{a} - \frac {24 i \, \log \left (\tan \left (d x + c\right )\right )}{a} + \frac {3 \, {\left (-9 i \, \tan \left (d x + c\right ) - 11\right )}}{a {\left (\tan \left (d x + c\right ) - i\right )}} + \frac {2 i \, {\left (22 \, \tan \left (d x + c\right )^{3} + 12 i \, \tan \left (d x + c\right )^{2} - 3 \, \tan \left (d x + c\right ) - 2 i\right )}}{a \tan \left (d x + c\right )^{3}}}{12 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4/(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/12*(27*I*log(tan(d*x + c) - I)/a - 3*I*log(-I*tan(d*x + c) + 1)/a - 24*I*log(tan(d*x + c))/a + 3*(-9*I*tan(
d*x + c) - 11)/(a*(tan(d*x + c) - I)) + 2*I*(22*tan(d*x + c)^3 + 12*I*tan(d*x + c)^2 - 3*tan(d*x + c) - 2*I)/(
a*tan(d*x + c)^3))/d

________________________________________________________________________________________

Mupad [B]
time = 4.09, size = 126, normalized size = 1.17 \begin {gather*} -\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,9{}\mathrm {i}}{4\,a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{4\,a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,2{}\mathrm {i}}{a\,d}+\frac {\frac {\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}{6\,a}-\frac {1}{3\,a}+\frac {3\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,a}+\frac {{\mathrm {tan}\left (c+d\,x\right )}^3\,5{}\mathrm {i}}{2\,a}}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^4\,1{}\mathrm {i}+{\mathrm {tan}\left (c+d\,x\right )}^3\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(c + d*x)^4/(a + a*tan(c + d*x)*1i),x)

[Out]

(log(tan(c + d*x) + 1i)*1i)/(4*a*d) - (log(tan(c + d*x) - 1i)*9i)/(4*a*d) + (log(tan(c + d*x))*2i)/(a*d) + ((t
an(c + d*x)*1i)/(6*a) - 1/(3*a) + (3*tan(c + d*x)^2)/(2*a) + (tan(c + d*x)^3*5i)/(2*a))/(d*(tan(c + d*x)^3 + t
an(c + d*x)^4*1i))

________________________________________________________________________________________